package com.vnt;

import org.kalmeo.kuix.core.model.DataProvider;

public class IndexList extends DataProvider {
	
	private static final String ID_PROPERTY = "id";
	private static final String NAME_PROPERTY = "name";
	private static final String CODE_PROPERTY = "code";
	private static final String SUMMARY_PROPERTY = "summary";

	// Id used for update or delete shopList from the record store
	public int id = -1;

	public String img;
	
	public String code;
	// ShopList's name
	public String name;

	// ShopList's date
	public String summary;
	
	public void setId(int id) {
		this.id = id;
		dispatchUpdateEvent(ID_PROPERTY);
	}
	
	public void setCode(String code) {
		this.code = code;
		dispatchUpdateEvent(NAME_PROPERTY);
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
		dispatchUpdateEvent(NAME_PROPERTY);
	}

	/**
	 * @param date the date to set
	 */
	public void setSummary(String summary) {
		this.summary = summary;
		dispatchUpdateEvent(SUMMARY_PROPERTY);
	}

	protected Object getUserDefinedValue(String property) {
		if (NAME_PROPERTY.equals(property)) {
			return this.name;
		}
		if (CODE_PROPERTY.equals(property)) {
			return this.name;
		}
		if (SUMMARY_PROPERTY.equals(property)) {
			return this.summary;
		}
		if (ID_PROPERTY.equals(property)) {
			return Integer.toString(id);
		}
		return null;
	}
}